﻿using System;
using System.Collections.Generic;
using System.Data.Entity;
using System.Data.Entity.ModelConfiguration.Conventions;
using System.Linq;
using System.Text;

namespace AppSerwis.Model
{
    public class MainModelContext : DbContext
    {
        public MainModelContext() : base() { }

        public MainModelContext(string stringNameOrConnectionString) : base(stringNameOrConnectionString) { }

        #region EntityCollection
        private DbSet<User> _users;
        public DbSet<User> Users
        {
            get {return this._users;}
            set {this._users = value;}
        }
        #endregion
        protected override void OnModelCreating(DbModelBuilder modelBuilder)
        {            
            modelBuilder.Conventions.Remove<PluralizingTableNameConvention>();
            Database.SetInitializer <MainModelContext> (null);
            modelBuilder.Configurations.Add(new UserMapping());
            base.OnModelCreating(modelBuilder);
        }
    }
}
